

<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/js/media/css/demo_table_jui.css" />
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/js/examples_support/themes/smoothness/jquery-ui-1.8.4.custom.css" />
<script type="text/javascript" charset="utf-8">
    $(document).ready(function() {
        oTable = $('#example').dataTable({
            "bJQueryUI": true,
            "sPaginationType": "full_numbers"
        });
    });
</script>
 <?php
        $session = new CHttpSession;
        $session->open();
        $userID = $session['user_salesmart'][3];
        
        $listshop = Shop::model()->findAll('flag in(1,4) and uid=' . $userID);

        $list = CHtml::listData($listshop, 'id', 'shopName');
        if(isset($_GET['id'])){
            $idd = $_GET['id'];
            echo CHtml::dropDownList('id','',$list,array('options' => array($idd => array('selected' => true)) , 'prompt' => '----- Chọn gian hang -----','onchange' => 'document.location.href = "' . Yii::app()->request->baseUrl . '/danh-sach-banner-shop/" + this.value'));
        }  else {
            echo CHtml::dropDownList('id','',$list,array('prompt' => '----- Chọn gian hang -----','onchange' => 'document.location.href = "' . Yii::app()->request->baseUrl . '/danh-sach-banner-shop/" + this.value'));
        }
        
        // echo $form->textField($model,'programid'); array( 'onchange' => 'document.location.href = "' . Yii::app()->request->baseUrl . '/them-city/" + this.value')
        ?>
<?php if (isset($model)) { ?>
    <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
        <thead>
            <tr>
                <th>Tên Banner</th>
          
                <th>Trạng thái</th>
                <th>Xóa</th>
            </tr>
        </thead>
        <tbody>
            <?php
            //include 'encode_decode.php';

            Yii::import('application.controllers.home.encode_decode');
            $md = new encode_decode();
          
            if (!empty($model)) {
              
                foreach ($model as $item) {
                    $ma = $md->encrypt($item->id);
                    ?>
                    <tr class="gradeA">
                        <td>

                            <?php echo '<a style="text-decoration: none" href="' . Yii::app()->request->baseUrl . '/xem-banner-shop/' . $ma . '">' . $item->name . '</a>' ?>
                        </td>
                       
                 
                        <td class="center">
                            <?php
                            if ($item->flag == 2) {
                                echo 'đã xóa';
                            } elseif ($item->flag == 1) {
                                echo 'đang hiện';
                            } else {
                                echo 'đang ẩn';
                            }
                            ?>
                        </td>
                        <td class="center">
                            <?php echo '<a style="text-decoration: none;color: red" href="' . Yii::app()->request->baseUrl . '/xoa-banner-shop/' . $ma . '">' . 'Xóa</a>' ?>
              
                        </td>
                    </tr>
                    <?php
                }
            }
            ?>
        </tbody>
    </table>
    <?php
} 
